<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>遍历</title>
</head>
<body>
<input type="button" id="btn" value="遍历列表项">
<ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>
</ul>
</body>
<script src="js/jquery-3.3.1.min.js"></script>
<script>
    //对象.each()方法
    $("#btn").click(function(){
        let lis=$("li");
        lis.each(function(index,ele){
            alert(ele.innerHTML+"=="+this.innerHTML);
        })
    });
</script>
</html>